<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="工单编号" prop="workOrderCode">
        <el-input
          v-model="queryParams.workOrderCode"
          placeholder="请输入工单编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工单类型" prop="workOrderType">
        <el-input
          v-model="queryParams.workOrderType"
          placeholder="请输入工单类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="客户名称" prop="clientName">
        <el-input
          v-model="queryParams.clientName"
          placeholder="请输入客户名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>


    <el-table v-loading="loading" :data="afterCostDetailsList" border>
      <el-table-column label="工单编号" align="center" prop="workOrderCode" />
      <el-table-column label="工单类型" align="center" prop="workOrderType" />
      <el-table-column label="客户名称" align="center" prop="clientName" />
      <el-table-column label="创建人" align="center" prop="createBy" />
      <el-table-column label="创建时间" align="center" prop="createTime">

      </el-table-column>
      <el-table-column label="费用(元)" align="center" prop="price" />
      <el-table-column label="处罚金额(元)" align="center" prop="disposalAmount" />
      <el-table-column label="合计(元)" align="center" prop="totalAmount" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>

import { listAfterCostDetails } from "@/api/mes/as/afterCostDetails"

export default {
  name: "AfterCostDetails",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 售后费用明细数据
      afterCostDetailsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        workOrderCode: null,
        workOrderType: null,
        clientId: null,
        clientCode: null,
        clientName: null,
        clientAddress: null,
        clientNick: null,
        issueType: null,
        workOrderStatus: null,
        person: null,
        phone: null,
        price: null,
        url: null,
        attr1: null,
        attr2: null,
        attr3: null,
        attr4: null,
      },
    }
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询售后工单列表 */
    getList() {
      this.loading = true;
      listAfterCostDetails(this.queryParams).then(response => {
        this.afterCostDetailsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
}
</script>
